package com.zhujiaji.controller;

import com.zhujiaji.common.Result;
import com.zhujiaji.pojo.User;
import com.zhujiaji.service.UserService;
import com.zhujiaji.util.JwtUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 朱佳吉
 * @date 2024/3/16 21:16
 */
@RestController
@RequestMapping("/api/user")
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping("/login")
    @ApiOperation("登录")
    public Result login(@RequestBody User user) {
        return userService.login(user);
    }

    @GetMapping("/getInfo")
    @ApiOperation(value = "获取用户信息")
    public Result getInfo(String token) {
        return userService.getInfo(token);
    }
}
